import React, { Component } from 'react';

/* 
    zujian挂载的时候
    1.constructor
    render
*/
class Tesing extends Component {
    state={
        
    }
    constructor(props){
        super(props)
        console.log("1.执行App组件的构造函数");
    }
    static getDerviedStateFromProps(props,state){
        console.log("2.执行getDerviedStateFromProps")
        // return null; 表示不会和当前状态合并
        return {
            // ...props,
            // msg:"🐂"
        }
    }
    render() {
        console.log("3.执行render函数")
        return (
            <div>
                <Tesingchild msg={"🐅"}></Tesingchild>
            </div>
        );
    }
    componentDidMount(){
        console.log("4.执行App组件中的componentDidMount")
    }
}
class Tesingchild extends Component {
    state={
        
    }
    static getDerivedStateFromProps(props,state){
        console.log(props)
        // return null
        return {
            ...props
        }
    }
    render() {
        return (
            <h1>Child组件</h1>
        );
    }
}


export default Tesing;